package com.wang.vedio.adapter.index;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wang.vedio.R;
import com.wang.vedio.net.entity.VideoBean;
import com.wang.vedio.net.rxjava.HttpMethods;

import java.util.List;

public class DetailsSuggestionAdapter extends BaseQuickAdapter<VideoBean, BaseViewHolder> {
    public DetailsSuggestionAdapter(int layoutResId, @Nullable List<VideoBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, VideoBean item) {
        helper.setText(R.id.tv_title, item.getTitle());
        helper.setText(R.id.tv_play_count, item.getPlayNum() + "");
        helper.setText(R.id.tv_duration, item.getVedioSeconds());
        ImageView imageViewAd = helper.getView(R.id.videoImg0);
        Glide.with(imageViewAd)
                .load(HttpMethods.BASE_URL+item.getVedioFmImg())
                .apply(RequestOptions.bitmapTransform(new MultiTransformation<>(new CenterCrop(), new RoundedCorners(30))))
                .into(imageViewAd);
    }
}
